﻿using SmartSapce.ServiceLocation;
using SmartSpace.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SmartSpace.WebApp._console
{
    public class ConsoleSitePage : System.Web.UI.Page
    {
        public Application CurrentApplication { get; private set; }


        public override void ProcessRequest(System.Web.HttpContext context)
        {
            ICoreService service = ServiceLocator.Get<ICoreService>();

            string curHostUrl = Request.Url.OriginalString.Replace(Request.Url.PathAndQuery, "/");
            SmartSpace.Core.Application application = service.GetApplication(curHostUrl);

            if (application == null)
            {
                Response.Redirect("./error.aspx");
            }
            else
            {

                base.ProcessRequest(context);
            }
        }
    }
}
